package com.rem.hutool.my5Utils;

import cn.hutool.core.util.EnumUtil;

import java.util.List;

/**
 * @Author Rem
 * @Date 2020-08-23
 */

public class EnumUtilDemo {


    public static void main(String[] args) {


        List<String> names = EnumUtil.getNames(TestEnum.class);
        System.err.println("枚举对象的name列表:" + names); //[TEST1, TEST2, TEST3]
        List<Object> type = EnumUtil.getFieldValues(TestEnum.class, "type");
        System.err.println("指定字段的值:" + type); //[TEST1, TEST2, TEST3]
    }


    public enum TestEnum {
        TEST1("type1"), TEST2("type2"), TEST3("type3");

        private String type;

        private TestEnum(String type) {
            this.type = type;
        }

        public String getType() {
            return this.type;
        }
    }
}
